﻿<ContentControl x:Class="Microsoft.VisualStudio.TestTools.WorkItemMigrator.ConfirmSettingsView"
                                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                                 xmlns:WorkItemMigrator="clr-namespace:Microsoft.VisualStudio.TestTools.WorkItemMigrator"
                                 x:ClassModifier="internal">
    <ContentControl.Resources>
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="FontSize" 
                    Value="13" />
            <Setter Property="TextWrapping"
                    Value="Wrap" />
            <Setter Property="Padding"
                    Value="15,0,0,0" />
        </Style>

        <Style TargetType="{x:Type BulletDecorator}">
            <Setter Property="Margin" 
                    Value="20,20,0,0" />
        </Style>
        <Style TargetType="{x:Type Image}">
            <Setter Property="Source"
                    Value="{DynamicResource Bullet_16}" />
            <Setter Property="Height"
                    Value="8" />
            <Setter Property="Width"
                    Value="8" />
            <Setter Property="Margin"
                    Value="0,1,0,0" />
            <Setter Property="VerticalAlignment"
                    Value="Top" />
        </Style>

        <WorkItemMigrator:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />



    </ContentControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Border Background="White"
            Grid.Row="0"
            BorderBrush="Gray"
            CornerRadius="2"
            BorderThickness="1">
            <ScrollViewer VerticalScrollBarVisibility="Auto">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <TextBlock Text="Click &apos;Save and migrate&apos; to perform the following actions:"
                           FontWeight="Bold"
                           Margin="0,5,0,0"
                           Grid.Row="0"
                           FontSize="14" />
                    <BulletDecorator Grid.Row="1">
                        <BulletDecorator.Bullet>
                            <Image />
                        </BulletDecorator.Bullet>
                        <BulletDecorator.Child>
                            <TextBlock Grid.Row="0"
                                       Text="Migrate the work items:" />
                        </BulletDecorator.Child>
                    </BulletDecorator>

                    <Grid Grid.Row="2"
                      Margin="50,0,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="10" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <TextBlock Grid.Row="0"
                                           Text="From"
                                           FontWeight="SemiBold"
                                           TextDecorations="Underline"/>
                        <Grid Grid.Row="1">
                            <Grid>
                                <Grid.Style>
                                    <Style TargetType="{x:Type Grid}">
                                        <Setter Property="Visibility" Value="Collapsed" />
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding DataSourceType}"
                                     Value="{x:Static WorkItemMigrator:DataSourceType.Excel}">
                                                <Setter Property="Visibility" Value="Visible" />
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Grid.Style>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <TextBlock Grid.Row="0"
                                           Text="{Binding DataSourceParser.StorageInfo.Source, StringFormat=Excel workbook: \&quot;{0}\&quot;}" />
                                <TextBlock Grid.Row="1"
                                       Text="{Binding DataSourceParser.StorageInfo.WorkSheetName, StringFormat=Excel worksheet: \&quot;{0}\&quot;}" />
                                <TextBlock Grid.Row="2"
                                       Text="{Binding DataSourceParser.StorageInfo.RowContainingFieldNames, StringFormat=Field names on excel row number: \&quot;{0}\&quot;}" />
                            </Grid>
                            <Grid>
                                <Grid.Style>
                                    <Style TargetType="{x:Type Grid}">
                                        <Setter Property="Visibility" Value="Collapsed" />
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding DataSourceType}"
                                     Value="{x:Static WorkItemMigrator:DataSourceType.MHT}">
                                                <Setter Property="Visibility" Value="Visible" />
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Grid.Style>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <TextBlock Grid.Row="0"
                                           Text="{Binding MHTSource, StringFormat=MHT/Word Source: \&quot;{0}\&quot;}" />
                            </Grid>
                        </Grid>

                        <TextBlock Grid.Row="3"
                                       Text="To"
                                       FontWeight="SemiBold"
                                       TextDecorations="Underline"/>
                        <TextBlock Grid.Row="4"
                                       Text="{Binding WorkItemGenerator.Server, StringFormat=TFS collection: \&quot;{0}\&quot;}" />
                        <TextBlock Grid.Row="5"
                                       Text="{Binding WorkItemGenerator.Project, StringFormat=Team project: \&quot;{0}\&quot;}" />
                        <TextBlock Grid.Row="6"
                                       Text="{Binding WorkItemGenerator.SelectedWorkItemTypeName, StringFormat=Test workitem type: \&quot;{0}\&quot;}" />
                    </Grid>


                    <BulletDecorator Grid.Row="3"
                                 Visibility="{Binding InputSettingsFilePath, Converter={StaticResource StringToVisibilityConverter}}">
                        <BulletDecorator.Bullet>
                            <Image />
                        </BulletDecorator.Bullet>
                        <BulletDecorator.Child>
                            <TextBlock Text="{Binding InputSettingsFilePath, StringFormat=Use existing settings file to migrate: \&quot;{0}\&quot;}" />
                        </BulletDecorator.Child>
                    </BulletDecorator>

                    <BulletDecorator Grid.Row="4"
                                 Visibility="{Binding OutputSettingsFilePath, Converter={StaticResource StringToVisibilityConverter}}">
                        <BulletDecorator.Bullet>
                            <Image />
                        </BulletDecorator.Bullet>
                        <BulletDecorator.Child>
                            <TextBlock>
                                <TextBlock.Text>
                                    <Binding Path="OutputSettingsFilePath" Mode="TwoWay">
                                        <Binding.StringFormat>
                                            Save current fields, data and links mappings and miscellaneous settings at: &quot;{0}&quot;                                        
                                        </Binding.StringFormat>
                                    </Binding>
                                </TextBlock.Text>
                            </TextBlock>

                        </BulletDecorator.Child>
                    </BulletDecorator>

                    <BulletDecorator Grid.Row="5"
                                 Visibility="{Binding Reporter.ReportFile, Converter={StaticResource StringToVisibilityConverter}}">
                        <BulletDecorator.Bullet>
                            <Image />
                        </BulletDecorator.Bullet>
                        <BulletDecorator.Child>
                            <TextBlock Text="{Binding Reporter.ReportFile, StringFormat=Save output logs(Passed/Warning/Failed) to: \&quot;{0}\&quot;}" />
                        </BulletDecorator.Child>
                    </BulletDecorator>

                </Grid>
            </ScrollViewer>
        </Border>
        <TextBlock Grid.Row="1"
                   HorizontalAlignment="Right"
                   Margin="0,5,0,0">
                    <Hyperlink IsEnabled="{Binding IsPreviewEnabled}"
                               AutomationProperties.AutomationId="ConfirmSettings.PreviewMHTButton"
                               AutomationProperties.Name="PreviewMHTButton"
                               Click="Hyperlink_Click"
                               x:Uid="ConfirmSettings.PreviewMHTButton">
                        Copy commandline to clipboard
                        <Hyperlink.Style>
                            <Style TargetType="{x:Type Hyperlink}">
                                <Setter Property="Foreground" 
                                        Value="{DynamicResource HyperLinkBrush}" />
                            </Style>
                        </Hyperlink.Style>
                    </Hyperlink>
        </TextBlock>
    </Grid>
</ContentControl>